package io;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

/**
 * 对象流是高级流，作用是进行对象的序列化与反序列化
 * 本案例演示序列化
 */
public class OosDemo {
    public static void main(String[] args)throws IOException {
        String name = "范进";
        int age = 25;
        String gender = "男";
        String[] otherInfo = {"Java","C++","Python"};
        Person person = new Person(name,age,gender,otherInfo);

        FileOutputStream fos = new FileOutputStream("person.obj");
        ObjectOutputStream oos = new ObjectOutputStream(fos);
        oos.writeObject(person);
        System.out.println("序列化完毕");
        oos.close();

    }
}
